﻿namespace AutoUnzip.Core
{
    public static class Helper
    {
        public static string ToReadableSize(double folderSize)
        {
            string[] sizes = { "B", "KB", "MB", "GB", "TB" };
            int order = 0;
            while (folderSize >= 1000 && order + 1 < sizes.Length)
            {
                order++;
                folderSize = folderSize / 1024;
            }
            return string.Format("{0:0.##} {1}", folderSize, sizes[order]);
        }
    }
}